import numpy

import time

class Scanner(  ):

    def __init__(self, xrange, yrange, zrange):
        self.xRange = xrange
        self.yRange = yrange
        self.zRange = zrange

    def getXRange(self):
        return self.xRange

    def getYRange(self):
        return self.yRange

    def getZRange(self):
        return self.zRange

    def setx(self, x):
        pass
    def sety(self, y):
        pass
    def setz(self, z):
        pass
    def setPosition(self, x, y, z):
        """Move stage to x, y, z"""
        pass
    def scanLine(self, Line, SecondsPerPoint, return_speed=None):
        time.sleep(0.1)
        return numpy.sin(Line[0,:])*numpy.sin(Line[1,:])*numpy.exp(-Line[2,:]**2)
#        return numpy.random.random(Line.shape[1])

    def setTiming(self, SettlingTime, CountTime):
        pass

    def startCounter(self, SettlingTime, CountTime):
        pass

    def stopCounter(self):
        pass

    def Count(self):
        return int(10000000.*numpy.random.random())

class Counter(  ):

    _DefaultSettlingTime = 2e-3
    _DefaultCountTime = 8e-3

    def __init__(self):
        self.setTiming(self._DefaultSettlingTime, self._DefaultCountTime)

    def setTiming(self, SettlingTime, CountTime):
        self._SettlingTime = SettlingTime
        self._CountTime = CountTime

    def getTiming(self):
        return self._SettlingTime, self._CountTime

    def setCountLength(self, n):
        self._CountLength = n
        
    def countLength(self):
        return self._CountLength
        
    def configure(self, n, SecondsPerPoint, DutyCycle=0.8):
        self._n = n
        
    def run(self):
        time.sleep(1)
        return numpy.random.random(self._n)
        
    def clear(self):
        pass
        
    def StartCI(self):
        pass
    def StartCO(self):
        pass
    def WaitCI(self):
        pass
        
    def ReadCI(self):
        time.sleep(1)
        return numpy.random.random(self._CountLength)
        
    def StopCI(self):
        pass
    
    def StopCO(self):
        pass

    def startCounter(self):
        pass

    def stopCounter(self):
        pass

    def Count(self):
        return int(10000000.*numpy.random.random())

class Microwave(  ):

    def Off(self):
        return 'off'
    
    def On(self):
        return 'on'
    
    def Power(self, power=None):
        if power != None:
            return power
        else:
            return 0.0

    def setPower(self, power):
        pass

    def setOutput(self, power, frequency):
        pass

    def Freq(self, f=None):
        if f != None:
            return f
        else:
            return 1.0

    def CW(self, f=None, power=None):
        pass

    def List(self, freq, power):
        pass

    def Trigger(self, source, pol):
        pass

    def initSweep(self, f, p):
        pass

    def ListOn(self):
        pass

    def ResetListPos(self):
        pass

    def resetListPos(self):
        pass

    def Sweep(self, f_start, f_stop, df):
        return int(round((f_start-f_stop))/df)

    def SweepPos(self, f=None):
        if f != None:
            return f
        else:
            return 1.0

    def AM(self, depth=None):
        if depth != None:
            return depth
        else:
            return 1.0

    def Modulation(self, flag=None):
        return False

class RF(  ):
    def Output(self):
        return False
    def On(self):
        pass
    def Off(self):
        pass
    def Power(self, power=None):
        return 0.0
    def Freq(self, f=None):
        return 1.0
    def CW(self, f=None, power=None):
        pass
    def List(self, freq, power):
        return 10
    def ListOn(self):
        pass
    def ResetListPos(self):
        return '0'
    def Sweep(self, f_start, f_stop, df):
        return 10
    def SweepPos(self, f=None):
        return 1.0
    def AM(self, depth=None):
        return 0.0


class PulseGenerator(  ):
    def Sequence(self, *args, **kwargs):
        pass
    def Light(self, *args, **kwargs):
        pass
    def Night(self, *args, **kwargs):
        pass
    def Open(self, *args, **kwargs):
        pass
    def High(self, *args, **kwargs):
        pass

class FastCounter(  ):
    def Configure(self, *args, **kwargs):
        pass
    def GetData(self, *args, **kwargs):
        pass
    def GetState(self, *args, **kwargs):
        pass
    def Start(self, *args, **kwargs):
        pass
    def Halt(self, *args, **kwargs):
        pass

class WaveformGenerator(  ):
    pass
    
class Flopper(  ):
    pass

